vulkan_icd_lib_path = get_option('prefix') / get_option('libdir')
endif
+vulkan_manifest_per_architecture = get_option('vulkan-manifest-per-architecture')
+
+if vulkan_manifest_per_architecture
+ vulkan_manifest_suffix = '@0@.json'.format(host_machine.cpu())
+else
+ vulkan_manifest_suffix = 'json'
+endif
subdir('include')
subdir('bin')
'Default: $datadir/vulkan/icd.d'
)
+option(
+ 'vulkan-manifest-per-architecture',
+ type : 'boolean',
+ value : true,
+ description : 'If true, Vulkan ICDs have a separate JSON manifest per ' +
+ 'architecture, for example lvp_icd.x86_64.json. ' +
+ '(Recommended for non-default ${prefix}.) ' +
+ 'If false, all architectures share a single JSON manifest, ' +
+ 'for example lvp_icd.json, referencing the library by its ' +
+ 'basename. ' +
+ '(Recommended for Unix OS distros installing into /usr.)'
+)
+
option(
'moltenvk-dir',
type : 'string',
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
]
if with_platform_windows
radeon_icd = custom_target(
'radeon_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'radeon_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'radeon_icd.' + vulkan_manifest_suffix,
command : icd_command,
build_by_default : true,
install_dir : with_vulkan_icd_dir,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
asahi_icd = custom_target(
input : [vk_icd_gen, vk_api_xml],
- output : 'asahi_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'asahi_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
broadcom_icd = custom_target(
'broadcom_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'broadcom_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'broadcom_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
freedreno_icd = custom_target(
'freedreno_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'freedreno_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'freedreno_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
]
if host_machine.system() == 'windows'
lvp_icd = custom_target(
'lvp_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'lvp_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'lvp_icd.' + vulkan_manifest_suffix,
command : icd_command,
build_by_default : true,
install_dir : with_vulkan_icd_dir,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
gfxstream_icd = custom_target(
'gfxstream_vk_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'gfxstream_vk_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'gfxstream_vk_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.1', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
powervr_mesa_icd = custom_target(
'powervr_mesa_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'powervr_mesa_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'powervr_mesa_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
intel_icd = custom_target(
'intel_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'intel_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'intel_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
intel_hasvk_icd = custom_target(
'intel_hasvk_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'intel_hasvk_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'intel_hasvk_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.1', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
]
prog_python, '@INPUT0@',
'--api-version', '1.1', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', join_paths(meson.current_build_dir(), icd_file_name),
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
]
dzn_icd = custom_target(
'dzn_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'dzn_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'dzn_icd.' + vulkan_manifest_suffix,
command : icd_command,
build_by_default : true,
install_dir : with_vulkan_icd_dir,
nouveau_icd = custom_target(
'nouveau_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'nouveau_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'nouveau_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
panfrost_icd = custom_target(
'panfrost_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'panfrost_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'panfrost_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
virtio_icd = custom_target(
'virtio_icd',
input : [vk_icd_gen, vk_api_xml],
- output : 'virtio_icd.@0@.json'.format(host_machine.cpu()),
+ output : 'virtio_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', vulkan_icd_lib_path / icd_file_name,
+ '--icd-lib-path', vulkan_icd_lib_path,
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
- '--lib-path', meson.current_build_dir() / icd_file_name,
+ '--icd-lib-path', meson.current_build_dir(),
+ '--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
import argparse
import json
+import os
import re
import xml.etree.ElementTree as et
help='Vulkan registry XML for patch version')
parser.add_argument('--sizeof-pointer', required=False, type=int,
help='sizeof(void*) on the host cpu')
- parser.add_argument('--lib-path', required=True,
- help='Path to installed library')
+ parser.add_argument('--icd-lib-path', required=True,
+ help='Folder of icd lib_path to installed library')
+ parser.add_argument('--icd-filename', required=True,
+ help='Filename of icd lib_path to installed library')
parser.add_argument('--out', required=False,
help='Output json file.')
parser.add_argument('--use-backslash', action='store_true',
else:
re.match(r'\d+\.\d+\.\d+', version)
- lib_path = args.lib_path
+ lib_path = args.icd_filename
+ if args.out and len(os.path.basename(args.out).split('.')) == 3:
+ # The output filename is the form of '${icd_id}.${host_machine.cpu()}.json',
+ # that means vulkan_manifest_per_architecture are true.
+ lib_path = args.icd_lib_path + '/' + args.icd_filename
+
if args.use_backslash:
lib_path = lib_path.replace('/', '\\')